package com.mjr.webmanage.service.impl;

import com.mjr.webmanage.mapper.EmpMapper;
import com.mjr.webmanage.pojo.JobOption;
import com.mjr.webmanage.service.ReportService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Slf4j
@Service
public class ReportServiceImpl implements ReportService {

    @Autowired
    private EmpMapper empMapper;

    @Override
    public JobOption empJobData() {

        List<Map> jobData = empMapper.getJobData();
        log.info("================" + jobData);
        List<Object> jobList = jobData.stream().map(map -> map.get("pos")).toList();
        List<Object> dataList = jobData.stream().map(map -> map.get("posCount")).toList();
        return new JobOption(jobList, dataList);
    }

    @Override
    public Object getGenderData() {

        List<Map> genderData = empMapper.getGenderData();
        return genderData;
    }
}
